
function[lt_response] = pp_lt_response(fday, ut_shift)
% fday = floating UT decimal day in MATLAB convention
% ut_shift =  Localtime - UT,  in decimal hours;
% fday is decimal day starting on 2000:1:1:00:00:00
% Function returns the normalizing factor for prompt penetration with
% respect to local time.

%

if ispc == 1,
    
    load E:\projects\ace_tensor\correlation_smoothed sp;
    
end;

if isunix == 1,
    
    %load /Users/manojnair/Documents/projects/ace_tensor/correlation_smoothed sp;
    %load /data/backup/mnair/ace_tensor/correlation_smoothed sp; % 2011 data
    load  /Users/manojnair/projects/Carrington_1859_event/DONOTDELETE_pp_lt_response sp; % new 2012 data
end;


fday = fday + ut_shift/24;
fday_local = fday - floor(fday);

lt_response = ppval(fday_local*24,sp) ;

% the PP response is killing the signal amplitude. Here is a sigmoid
% function to retake the amplitude. 
% 
%   L = lt_response  >= 0;
%   lt_res(L) =  1./(1+exp(-20*lt_response (L)));
%   L = lt_response < 0;
%   lt_res(L) =  (-1) * 1./(1+exp(-20*abs(lt_response (L))));
%  
% % lt_response = 1./(1+exp(-20*lt_response ));
%  
% lt_response = lt_res';

